package xddq

import (
	"fmt"
	"time"
	D "websocket_apn/define"
	"websocket_apn/log"
	"websocket_apn/proto"
)

/*

领取
[DEBUG] [2024/05/29 08:56:10] [src/websocket_apn/main_test.go]:[  193]:   ↑↑↑↑↑ S_PALACE_SEND_GIFT_GET_REWARD - len:63
[DEBUG] [2024/05/29 08:56:10] [src/websocket_apn/main_test.go]:[  197]:   PayloadBytes: 71 AB 00 00 00 3F 00 00 60 E7 00 00 02D4 07 01 81 E2 0A 27 50 41 4C 41 43 45 2D 47 49 46 54 2D 33 31 30 39 36 37 35 2D 33 31 30 39 36 37 35 34 35 38 34 39 30 2D 72 6F 66 77 6A 10 01 18 01
[DEBUG] [2024/05/29 08:56:10] [src/websocket_apn/main_test.go]:[  199]:   	>>> 1 - code 0A[10] len:39-50 41 4C41 43 45 2D 47 49 46 54 2D 33 31 30 39 36 37 35 2D 33 31 30 39 36 37 35 34 35 38 34 39 30 2D 72 6F 66 77 6A_
PALACE-GIFT-3109675-3109675458490-rofwj
[DEBUG] [2024/05/29 08:56:10] [src/websocket_apn/main_test.go]:[  199]:   	>>> 2 - code 10[16] len:1-18_

*/
//处理仙官送福礼物信息
func (xd *XdDriver) CheckSendGiftInfoData(allInfo []D.SendGiftInfo) {
	if err := xd.waitForStartSendCmd(); err != nil {
		return
	}
	for _, info := range allInfo {
		// {ID:ABFFA387C15A Name:凝丶安可 GiftID:50414C4143452D474946542D333130393834302D333130393834303032373536332D6E776C6B61 GiftType:01}
		log.Infof("仙官送福-领取[%s]的礼物", info.Name)
		xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_PALACE_SEND_GIFT_GET_REWARD, fmt.Sprintf("0A %02X %s 10 01 18 %s", len(info.GiftID)/2, info.GiftID, info.GiftType)))
		time.Sleep(100 * time.Millisecond)
	}
}
